Image data representing an image is typically generated by using an image reading apparatus, such as a scanner. The image includes a document area representing a document. There is known a technology in which edge candidate lines, which are candidates of lines corresponding to edges of the document area, are calculated through Hough transform, a least-square technique, or the like based on coordinate values of edge candidate pixels in the image represented by the image data, and an inclination of the document area is calculated based on the edge candidate lines calculated. Further, for the purpose of improving accuracy of detection of the inclination of the document, there is known a method of selecting two sides orthogonal to each other or two sides parallel to each other of the sides of the document to detect the inclination of the document.